<?php
namespace Home\Controller;
use Think\Controller;
class ConsoleController extends Controller {


	public function consolelist(){
		//获取所有大师信息
		$console_id=$_GET['console_id'];
		$consoleModel=M('console');
		$console=$consoleModel->table('console c,users u')->where('c.user_id=u.user_id')->select();
		$this->console=$console;
		$this->ajaxReturn($console,'JSON');
		echo json_encode($console);

	}
	public function getConsoleDetail(){
		//获取当前用户咨询信息详情页面
		$consoleDetailModel=M('console');
		$user_id=$_GET['user_id'];
		$consoleDetail=$consoleDetailModel->table('console c,users u')->where("u.user_id='$user_id' and c.user_id=u.user_id")->field('c.console_id,c.console_content,u.*')->select();
		$this->consoleDetail=$consoleDetail;
		$this->ajaxReturn($consoleDetail,'JSON');
		//echo json_encode($consoleDetail);
	}
	

// 	public function addConsole(){
// //提交上传咨询信息
//     $data['console_id']=$_GET['console_id'];
//     $data['master_picture']=$_GET['master_picture'];
//     $data['master_introduce']=$_GET['master_introduce'];
//     $data['username']=$_GET['username'];
//     $data['console_content']=$_GET['console_content'];
//     $data['createtime'] = date("Y-m-d H:i:s");
//     $data['user_id'];
//     $consolemodel=M('console');                                         
//     $console=$consolemodel->add($data);
//     if(false !==$console){   
//     $this->ajaxReturn(SUCCESS,'JSON');
//     }else{
//         //$this->false;
//          $this->ajaxReturn($FALSE,'JSON');
//     }
//     }
}
?>